﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DataAccessLayer;
using Entities;
using System.Data;
namespace BusinessLogicLayer
{
    public class SachBO
    {
        private SachDAL dal;
        public SachBO()
        {
            try
            {
                dal = new SachDAL();
            }
            catch (Exception e)
            {
                throw new BusinessLogicException();
            }
        }
        public DataTable layDanhSachSach()
        {
            DataTable s = null;
            try
            {
                s = dal.layDanhSachSach();
            }
            catch (Exception)
            {
                throw;
            }
            return s;
        }
        public Sach GetSachByID(int id)
        {
            Sach s = null;
            try
            {
                s = dal.GetSachByID(id);
            }
            catch (Exception)
            {
                throw;
            }
            return s;
        }
        public DataTable TraCuuSach(Sach s, string tenTacGia)
        {
            DataTable dt = null;
            try
            {
                dt = dal.TraCuuSach(s, tenTacGia);
            }
            catch (Exception)
            {
                throw;
            }
            return dt;
        }
        public int InsertSach(Sach s)
        {
            int dt = 0;
            try
            {
                dt = dal.InsertSach(s);
                return dt;
            }
            catch (Exception)
            {
                return dt;
                throw;
            }

        }
        public int DeleteSach(string maSach)
        {
            int dt = 0;
            try
            {
                dt = dal.DeleteSach(maSach);
                return dt;
            }
            catch (Exception)
            {
                return dt;
                throw;
            }

        }
        public int UpdateSach(Sach s)
        {
            int dt = 0;
            try
            {
                dt = dal.UpdateSach(s);
                return dt;
            }
            catch (Exception)
            {
                return dt;
                throw;
            }

        }
        public int UpdateSoLuongTonCuaSach(Sach s)
        {
            int dt = 0;
            try
            {
                dt = dal.UpdateSoLuongTonCuaSach(s);
                return dt;
            }
            catch (Exception)
            {
                return dt;
                throw;
            }

        }
    }
}
